package web.mb;

import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;

public class task extends TimerTask { 
    Random r=new Random(); 
    public void run() { 
        try { 
            System.out.println("DEBUT"); 
            int t = 1000 + r.nextInt(1500); 
            Thread.sleep(t); 
            System.out.println("FIN : " + t); 
        } catch (InterruptedException e) { 
            e.printStackTrace(); 
        } 
    }
    
    public static void main(String[] args) { 
        Timer t = new Timer(); 
        GregorianCalendar gc = new GregorianCalendar(); 
        gc.add(Calendar.SECOND, 3); 
        t.scheduleAtFixedRate(new task(), gc.getTime(),2000); 
    } 
} 



